package com.kuang.lambda;

public class TestLambda02 {
    public static void main(String[] args) {

        Ilove love1 = null;
        Ilove love2 = null;
        Ilove love3 = null;
        Ilove love4 = null;
        //标准Lambda用法
        love1 = (String name)->{
            System.out.println("I love you + " + name);
        };

        //简化1：如果参数类型与接口一样，去掉参数类型
        love2 = (name)->{
            System.out.println("I love you + " + name);
        };

        //简化2：简化括号，多个参数必须要括号
        love3 = name -> {
            System.out.println("I love you + " + name);
        };

        //简化3：去掉花括号{需要代码只有一行}
        love4 = name-> System.out.println("I love you + " + name);

        love1.SayLove("咬人猫1");
        love2.SayLove("咬人猫2");
        love3.SayLove("咬人猫3");
        love4.SayLove("咬人猫4");

    }
}
interface Ilove{
    void SayLove(String name);
}


